import React from "react";
import _ from 'lodash';
import { Switch, Route, Redirect,withRouter } from "react-router-dom";
import { loadable } from "@utils/loadable";
//
const Resouce404 = loadable(import('@views/Resouce404.jsx'));
//
const Home = loadable(import('@views/Home.jsx'));
const Login = loadable(import('@views/Login.jsx'));
const Content = loadable(import('@views/con/Content.jsx'));
const List = loadable(import('@views/list/Content.jsx'));
const ListDetail = loadable(import('@views/list/Detail.jsx'));
//
@withRouter
class Router extends React.Component{

    componentWillMount(){
        _.his = this.props.history;
    }

    render(){
        return (
            <Switch>
                <Route exact path="/login" component={Login} />
                <Route exact path="/home" component={Home} />
                <Route path="/con" component={Content} />
                <Route path="/list" component={List} />
                <Route path="/listDetail" component={ListDetail} />
                {/*  */}
                <Route exact path="/resouce404" component={Resouce404} />
                <Redirect exact from="/" to="/home" />
                <Redirect exact from="" to="/home" />
                <Redirect from="*" to="/resouce404" />
            </Switch>
        )
    }
}

export default Router;
